home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_8 / issue_06 / risc_os / Wimp / Drag < prev    next >
Encoding:
Text File  |  1988-12-06  |  3.7 KB  |  79 lines

  1. > Wimp.Drag
  2.  
  3. New Calls
  4. ---------
  5.  
  6.         Wimp_DragBox
  7.  
  8.         *Configure WimpFlags
  9.  
  10.  
  11. Wimp_DragBox
  12. ------------
  13.  
  14. Entry:  R1 <= 0 ==> cancel dragbox, else:
  15.         R1 --> block:
  16.           +0  window handle (for codes 1..4)
  17.           +4  reason code:
  18.                 1  drag window position
  19.                 2  drag window size
  20.                 3  drag window horizontal scroll bar
  21.                 4  drag window vertical scroll bar
  22.                 5  drag box - fixed size
  23.                 6  drag box - rubber box
  24.                 7  drag point - invisible box
  25.                 8  drag fixed box - user-supplied subroutines
  26.                 9  drag rubber box- user-supplied subroutines
  27.                10  as (8), but don't cancel when buttons released
  28.                11  as (9), but don't cancel when buttons released
  29.           +8  initial position of drag box (x0,y0,x1,y1)
  30.          +24  parent box (other box restricted to this box (x0,y0,x1,y1)
  31.               this box is computed from the window data for codes 1..4
  32.          +40  R12 value to pass to subroutines (for types 7..11)
  33.          +44  address of subroutine to call to draw box
  34.          +48  address of subroutine to call to remove box
  35.          +52  address of subroutine to call to move box (<=0 ==> can't)
  36.               - previous box coordinates are supplied
  37.               - the box may or may not have changed position
  38.  
  39.          User-supplied subroutines:
  40.          Entry:  SVC mode, 
  41.                  R0-R3 = new box coordinates (as derived by mouse movements)
  42.                  R4-R7 = previous box coordinates (undefined unless moving)
  43.          Exit:   R0-R3 = actual box coordinates (normally unchanged)
  44.  
  45. The new drag reason codes are 8..11, and the action of codes 1..4 has also
  46. changed.  In the new Wimp, bits 0..3 of the configured Wimp flags determine
  47. the action of drag codes 1..4.  If the equivalent bit in the flags is zero,
  48. the action is as before (on Wimp 1.20), but if it is 1, then the window is
  49. 'continuously' dragged, another Open_Window_Request being returned every time
  50. the mouse is moved, rather than just at the end when the buttons are
  51. released.
  52.  
  53. The new reason codes from 8 to 11 can be used for all sorts of effects, since
  54. the caller is free to supply any subroutines he likes to update the 'box' (or
  55. whatever it is!).  Note that if a program wishes to drag an object across the
  56. Wimp screen while other tasks are running, it should use this facility to do
  57. so, since the Wimp will tell the application when to remove its 'object' due
  58. to other programs wishing to write to the screen - without this, it is not
  59. possible to maintain the screen display correctly in such an environment.
  60.  
  61. The Wimp performs its usual code to deal with rotating dot-dash patterns when
  62. calling user-supplied subroutines, so facilitating the drawing of arbitrary
  63. shapes using such patterns.  The basic method is that the Wimp EORs the
  64. patterns onto the screen - if the box has moved, then there is nothing for it
  65. but to EOR the old box off the screen, followed by EORing the new box onto
  66. the screen, but if the box has not moved, then the Wimp reprograms the
  67. dot-dash pattern so that a single EOR of the box is sufficient to 'rotate'
  68. it.  This means that the user-supplied 'move' subroutine must check to see if
  69. the new coordinates are different from the old ones - if they are, then it
  70. must EOR off the old box and EOR on the new, whereas if they are the same, it
  71. should simply EOR the box once.  Note that the Wimp will have programmed the
  72. dot-dash pattern appropriately for this, so the result will not be correct
  73. unless this procedure is followed.
  74.  
  75. Of course, the subroutines supplied could also be used to manipulate a sprite
  76. around the screen, by saving the contents of the screen and restoring them
  77. appropriately.  This is left as an exercise to the reader!
  78.  
  79.